/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dabarobjects.mobile.ui.actions;

import com.dabarobjects.mobile.calls.instructions.CallQueryResponseFormatter;
import com.dabarobjects.mobile.calls.instructions.CallStatusFlags;
import com.dabarobjects.mobile.flow.CallStatusListener;
import com.dabarobjects.mobile.ui.inputs.TakeNumberForm;
import com.dabarobjects.ui.surfaces.actions.ExtendedUIAction;
import com.dabarobjects.ui.surfaces.actions.NiceOperationWaitingUI;

/**
 *
 * @author user
 */
public class PlaceCallAction extends ExtendedUIAction  {
    private DiallingServiceManager manager;
    public PlaceCallAction(DiallingServiceManager m) {
        super("Dial Number...");
        this.manager = m;
    }
    private NiceOperationWaitingUI ops;

    @Override
    public void performAction(NiceOperationWaitingUI ops) {
        this.ops = ops;
        ops.putMessage("Provide The Number");
        TakeNumberForm form = new TakeNumberForm();
        String number = (String) ops.takeInputBeforeContinue(form, 400, 250);
        if(number != null){
            manager.placeCall(number); 
            manager.updateStatusLabel("Calling " + number);
            ops.complete();
        }else{
            ops.complete();
        }
    }

   
}
